
#ifndef __BLOCK_H__
#define __BLOCK_H__

#include "cocos2d.h"
#include "data/Tree.h"

using namespace cocos2d;

class CBlock : public CCNode, public Tree
{
public:
	CBlock();
	~CBlock();

	static CBlock* blockWithType(int nType);

	int GetBlockType();
	void SetBlockType(int nType);
	
	void BlockRotate();
	void BlockFlyTo(CCPoint pt);

	bool isDoing();

private:
	void startAction();
	void doneAction();

	void resetOrient();

	void overrangeCheck(int& nVal, int nMax, int nDefaultVal);
private:
	CCSprite* m_pImage;
	int m_nBlockType;
	int m_nBlockOrient[4];

	int m_nPreZorder;

	bool m_bDoingAction;
};

#endif //__BLOCK_H__